﻿/*--------------------------------------------------------------------------------
 * Adaptive Intelligence - Foundation Framework
 * Version 2.10
 * 
 * TemplateInterface Interface
 *      Provides an interface template.
 *------------------------------------------------------------------------------*/

/*--------------------------------------------------------------------------------
 * System Imports
 *------------------------------------------------------------------------------*/
using System;
using System.IO;
using System.Xml;
using Adaptive.Foundation;

namespace Adaptive.Foundation.CodeDom
{
	/// <summary>
	/// Provides a signature and marker interface for CodeDOM objects which may be
	/// written to and read from an XML format.
	/// </summary>
	/// <remarks>
	/// In order to allow DOM constructions to be stored, this interface provides
	/// the common signature definitions for reading and writing CodeDOM DOM object
	/// instances.
	/// </remarks>
	public interface IXmlStorable
	{
		/// <summary>
		/// Attempts to save the specific object instance to an open stream.
		/// </summary>
		/// <param name="writer">
        /// An open <see cref="XmlWriter"/> instance used to write the content
		/// to the open stream.
		/// </param>
		/// <returns>
		/// <b>true</b> if the operation is successful; otherwise, returns <b>false</b>.
		/// </returns>
		bool Save(XmlWriter writer);
		/// <summary>
		/// Attempts to load the specific object content from an open stream.
		/// </summary>
		/// <param name="reader">
        /// An open <see cref="XmlReader"/> instance used to reader content
		/// from the open stream.
		/// </param>
		/// <returns>
		/// <b>true</b> if the operation is successful; otherwise, returns <b>false</b>.
		/// </returns>
		bool Load(XmlReader reader);
        /// <summary>
        /// Returns an XML representation of the current object instance.
        /// </summary>
        /// <returns>
        /// XML Code representing the current object instance.
        /// </returns>
        string ToXml();
	}
}
